﻿using System.Web;

namespace Tools.Utilities
{
    public static class ApplicationUtils
    {
        public static string GetBaseUrl()
        {
            return HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Authority + HttpContext.Current.Request.ApplicationPath.TrimEnd('/') + "/";
        }

        public static string GetImageUrl(string imageName)
        {
            return HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Authority + HttpContext.Current.Request.ApplicationPath.TrimEnd('/') + "/Content/images/" + imageName;
        }

        public static string GetBaseContentUrl()
        {
            return HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Authority + HttpContext.Current.Request.ApplicationPath.TrimEnd('/') + "/Content/";
        }

        public static string GetIconUrl(string imageName)
        {
            return HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Authority + HttpContext.Current.Request.ApplicationPath.TrimEnd('/') + "/Content/images/icons/" + imageName;
        }

        public static string GetBasePhysicalPath()
        {
            return HttpContext.Current.Server.MapPath("~");
        }

        public static string GetPhysicalPath(string url)
        {
            return HttpContext.Current.Server.MapPath(url);
        }
    }
}